package com.ipfsemc.ipfsemc;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

//@EnableAutoConfiguration()
@MapperScan("com.ipfsemc.ipfsemc.mapper")
@EnableTransactionManagement
@EnableScheduling
@ServletComponentScan
//@EnableAutoConfiguration(exclude = {MultipartAutoConfiguration.class})
@SpringBootApplication(exclude = {MultipartAutoConfiguration.class})
public class IpfsemcApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(IpfsemcApplication.class, args);
    }

    //解决上传文件控制层接收为null的方法
    @Bean(name = "multipartResolver")
    public CommonsMultipartResolver multipartResolver() {
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
        return multipartResolver;
    }

}
